<CFPARAM NAME="userid" DEFAULT="0">


<CFIF isdefined('form.Action')>
	<CFIF form.Action is "INSERT">
		
<CFQUERY name="addusers" datasource="#application.dsn#">
INSERT INTO users (
	username,
	password,
	name,
	email

)
VALUES
(
	'#username#',
	'#password#',
	'#name#',
	'#email#'

)
</CFQUERY>

		<CFLOCATION url="users_list.cfm?msg=item has been added">
	
	<CFELSE>
	
	
		
<CFQUERY DATASOURCE="trac_fu" NAME="updateusers">
UPDATE users
SET 
username='#username#',
password='#password#',
name='#name#',
email='#email#'

WHERE userid=#userid#
</CFQUERY>


		<CFLOCATION url="users_list.cfm?msg=item has been updated">
	
	</CFIF>
</CFIF>

<cfquery datasource="#application.dsn#" name="getusers">
SELECT * FROM users
WHERE userid=#userid#  
</cfquery>



<FORM action="users_frmaddedit.cfm" method="post" name="frmusers">

	<INPUT TYPE="hidden" NAME="userid" value="<cfoutput>#userid#</cfoutput>">

<table width="100%" cellspacing="0" cellpadding="0">


		<TR>
			<TD>username</TD>
			<TD><INPUT TYPE="TEXT" NAME="username" VALUE="<cfoutput>#getusers.username#</cfoutput>"  SIZE="25"></TD>
		</TR>

		<TR>
			<TD>password</TD>
			<TD><INPUT TYPE="TEXT" NAME="password" VALUE="<cfoutput>#getusers.password#</cfoutput>"  SIZE="100"></TD>
		</TR>

		<TR>
			<TD>name</TD>
			<TD><INPUT TYPE="TEXT" NAME="name" VALUE="<cfoutput>#getusers.name#</cfoutput>"  SIZE="100"></TD>
		</TR>

		<TR>
			<TD>email</TD>
			<TD><INPUT TYPE="TEXT" NAME="email" VALUE="<cfoutput>#getusers.email#</cfoutput>"  SIZE="100"></TD>
		</TR>

	<TR>
		<TD colspan=2>
		<CFIF userid IS NOT 0>
			<INPUT TYPE="HIDDEN" NAME="Action" VALUE="UPDATE">
			<INPUT TYPE="SUBMIT" VALUE=" UPDATE ">
		<CFELSE>
			<INPUT TYPE="HIDDEN" NAME="Action" VALUE="INSERT">
			<INPUT TYPE="SUBMIT" VALUE=" INSERT ">
		</CFIF>
		</TD>
	</TR>
</TABLE>

</FORM>
